package com.itheima.controller;

import com.itheima.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.io.FileNotFoundException;

@Controller
public class DemoController {

    @Autowired
    private DemoService demoService;

    @RequestMapping("/show1")
    public String show1() throws Exception {
        System.out.println("抛出类型转换异常......");
        demoService.show1();
        return "index";
    }

    @RequestMapping("/show2")
    public String show2() throws Exception {
        System.out.println("抛出除零异常......");
        demoService.show2();
        return "index";
    }

    @RequestMapping("/show3")
    public String show3() throws Exception {
        System.out.println("抛出自定义异常......");
        demoService.show5();
        return "index";
    }
}
